package org.fengling.readingplatform.manager.controller;

import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.fengling.readingplatform.manager.service.MemberService;
import org.fengling.readingplatform.model.dto.member.MemberDto;
import org.fengling.readingplatform.model.entity.member.Member;
import org.fengling.readingplatform.model.vo.common.Result;
import org.fengling.readingplatform.model.vo.common.ResultCodeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "成员管理接口")
@RestController
@RequestMapping(value = "/admin/member")
public class MemberController {

    @Autowired
    private MemberService memberService;

    @GetMapping(value = "/findByPage/{pageNum}/{pageSize}")
    public Result findByPage(@PathVariable("pageNum") Integer pageNum,
                             @PathVariable("pageSize") Integer pageSize,
                             MemberDto memberDto){
        PageInfo<Member> pageInfo = memberService.findByPage(pageNum, pageSize, memberDto);
        return Result.build(pageInfo, ResultCodeEnum.SUCCESS);
    }

}
